/**
 *
 * @Title: 附件所属区分
 * @Description: 附件所属区分，"10：收房合同，11：收房解约协议，20：出房合同，21：出房解约协议"
 * @author jugui
 * @date 2018年4月21日 09:05:45
 */

package com.wish.wishhouse_foreclosure.enums;

public enum AttachmentRelationTypeEnum {
    SFHT("收房合同", 10),
    SFJYHT("收房解约协议", 11),
    CFHT("出房合同", 20),
    CFJYXY("出房解约协议", 21);
    private String name;
    private int index;

    private AttachmentRelationTypeEnum(String name, int index) {
        this.name = name;
        this.index = index;
    }

    // 普通方法
    public static String getName(int index) {
        for (AttachmentRelationTypeEnum c : AttachmentRelationTypeEnum.values()) {
            if (c.getIndex() == index) {
                return c.name;
            }
        }
        return null;
    }

    public static Integer getIndex(String name) {
        for (AttachmentRelationTypeEnum c : AttachmentRelationTypeEnum.values()) {
            if (c.getName().equals(name)) {
                return c.getIndex();
            }
        }
        return null;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getIndex() {
        return index;
    }

    public void setIndex(int index) {
        this.index = index;
    }
}
